runOnStartup(async runtime => {
    runtime.addEventListener("tick", () => tick())
    runtime.getLayout("MainLevel").addEventListener("afterlayoutstart", () => init())
});
function tick() {
    if (runtime.layout.name != "MainLevel") return;
    MirrPlayer.turnLeftorRight()
}
function init() {
    MirrPlayer.init()
}
globalThis.MirrPlayer = {
    init: function () {
        /**@type {ISpriteInstance */
        this.PlayerCollisionInstanceMoveBehavior = runtime.objects.PlayerCollision.getFirstInstance().behaviors['8Direction']
        /**@type {ISpriteInstance} */
        this.PlayerBoard = runtime.objects.PlayerBillboard.getFirstPickedInstance()
    },
    tick: function () {
    },
    turnLeftorRight: function () {
        /**@type {I8DirectionBehaviorInstance} */
        let moveb = this.PlayerCollisionInstanceMoveBehavior
        if (moveb.vectorX <= -16 || moveb.vectorX >= 16) {
            this.PlayerBoard.height = 64 * Math.sign(moveb.vectorX)
        }
    }
}
export default MirrPlayer